/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 * Description: Batch util Function Registry
 */
#include "batch_func_registry_util.h"
#include "batch_functions/batch_utilfunctions.h"

namespace omniruntime::codegen {
using namespace omniruntime::type;
using namespace codegen::function;


std::vector<Function> BatchUtilFunctionRegistry::GetFunctions()
{
    std::vector<Function> utilFnRegistry = {
        Function(reinterpret_cast<void *>(FillRowIndexArray), "fill_rowIdx", {}, { OMNI_INT, OMNI_INT }, OMNI_INT,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyNull), "batch_copy_null", {}, { OMNI_BOOLEAN }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(FillNull), "batch_fill_null", {}, { OMNI_BOOLEAN }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(FillBool), "batch_fill_literal", {}, { OMNI_BOOLEAN }, OMNI_BOOLEAN,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(FillInt32), "batch_fill_literal", {}, { OMNI_INT }, OMNI_INT, INPUT_DATA),
        Function(reinterpret_cast<void *>(FillInt64), "batch_fill_literal", {}, { OMNI_LONG }, OMNI_LONG, INPUT_DATA),
        Function(reinterpret_cast<void *>(FillInt64), "batch_fill_literal", {}, { OMNI_TIMESTAMP }, OMNI_TIMESTAMP,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(FillDecimal128), "batch_fill_literal", {}, { OMNI_DECIMAL128 },
            OMNI_DECIMAL128, INPUT_DATA),
        Function(reinterpret_cast<void *>(FillInt64), "batch_fill_literal", {}, { OMNI_DECIMAL64 }, OMNI_DECIMAL64,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(FillInt32), "batch_fill_literal", {}, { OMNI_DATE32 }, OMNI_DATE32,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(FillDouble), "batch_fill_literal", {}, { OMNI_DOUBLE }, OMNI_DOUBLE,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(FillString), "batch_fill_literal", {}, { OMNI_VARCHAR }, OMNI_VARCHAR,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(FillLength), "batch_fill_length", {}, { OMNI_INT }, OMNI_INT, INPUT_DATA),
        Function(reinterpret_cast<void *>(FillLengthInFuncExpr), "batch_fill_length_literal", {}, { OMNI_INT },
            OMNI_INT, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyInt32), "batch_copy", {}, { OMNI_INT }, OMNI_INT, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyInt64), "batch_copy", {}, { OMNI_LONG }, OMNI_LONG, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyInt64), "batch_copy", {}, { OMNI_TIMESTAMP }, OMNI_TIMESTAMP, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyDecimal128), "batch_copy", {}, { OMNI_DECIMAL128 }, OMNI_DECIMAL128,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyInt32), "batch_copy", {}, { OMNI_DATE32 }, OMNI_DATE32, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyInt64), "batch_copy", {}, { OMNI_DECIMAL64 }, OMNI_DECIMAL64, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyDouble), "batch_copy", {}, { OMNI_DOUBLE }, OMNI_DOUBLE, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyBoolean), "batch_copy", {}, { OMNI_BOOLEAN }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyString), "batch_copy", {}, { OMNI_VARCHAR }, OMNI_VARCHAR, INPUT_DATA),
        Function(reinterpret_cast<void *>(CopyString), "batch_copy", {}, { OMNI_CHAR }, OMNI_CHAR, INPUT_DATA),
        Function(reinterpret_cast<void *>(CreateNot), "batch_not", {}, { OMNI_BOOLEAN }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(CreateAnd), "batch_and", {}, { OMNI_BOOLEAN, OMNI_BOOLEAN }, OMNI_BOOLEAN,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(CreateOr), "batch_or", {}, { OMNI_BOOLEAN, OMNI_BOOLEAN }, OMNI_BOOLEAN,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(CreateAndNot), "batch_and_not", {},
            { OMNI_BOOLEAN, OMNI_BOOLEAN, OMNI_INT, OMNI_INT }, OMNI_INT, INPUT_DATA),
        Function(reinterpret_cast<void *>(CreateAndNotBool), "batch_and_not", {}, { OMNI_BOOLEAN, OMNI_BOOLEAN },
            OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(CreateOrExpr), "batch_or_expr", {}, { OMNI_BOOLEAN, OMNI_BOOLEAN },
            OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(CreateAndExpr), "batch_and_expr", {}, { OMNI_BOOLEAN, OMNI_BOOLEAN },
            OMNI_BOOLEAN, INPUT_DATA),

        Function(reinterpret_cast<void *>(Coalesce<bool>), "batch_coalesce", {}, { OMNI_BOOLEAN, OMNI_BOOLEAN },
            OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(Coalesce<int32_t>), "batch_coalesce", {}, { OMNI_INT, OMNI_INT }, OMNI_INT,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(Coalesce<int64_t>), "batch_coalesce", {}, { OMNI_LONG, OMNI_LONG }, OMNI_LONG,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(Coalesce<int64_t>), "batch_coalesce", {}, { OMNI_TIMESTAMP, OMNI_TIMESTAMP },
            OMNI_TIMESTAMP, INPUT_DATA),
        Function(reinterpret_cast<void *>(Coalesce<double>), "batch_coalesce", {}, { OMNI_DOUBLE, OMNI_DOUBLE },
            OMNI_DOUBLE, INPUT_DATA),
        Function(reinterpret_cast<void *>(CoalesceString), "batch_coalesce", {}, { OMNI_VARCHAR, OMNI_VARCHAR },
            OMNI_VARCHAR, INPUT_DATA),
        Function(reinterpret_cast<void *>(Coalesce<int64_t>), "batch_coalesce", {}, { OMNI_DECIMAL64, OMNI_DECIMAL64 },
            OMNI_DECIMAL64, INPUT_DATA),
        Function(reinterpret_cast<void *>(Coalesce<int32_t>), "batch_coalesce", {}, { OMNI_DATE32, OMNI_DATE32 },
            OMNI_DECIMAL64, INPUT_DATA),
        Function(reinterpret_cast<void *>(Coalesce<Decimal128>), "batch_coalesce", {},
            { OMNI_DECIMAL128, OMNI_DECIMAL128 }, OMNI_DECIMAL128, INPUT_DATA),

        Function(reinterpret_cast<void *>(IfExpr<bool>), "batch_if", {}, { OMNI_BOOLEAN }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExpr<int32_t>), "batch_if", {}, { OMNI_INT }, OMNI_INT, INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExpr<int64_t>), "batch_if", {}, { OMNI_LONG }, OMNI_LONG, INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExpr<int64_t>), "batch_if", {}, { OMNI_TIMESTAMP }, OMNI_TIMESTAMP,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExpr<double>), "batch_if", {}, { OMNI_DOUBLE }, OMNI_DOUBLE, INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExprString), "batch_if", {}, { OMNI_VARCHAR }, OMNI_VARCHAR, INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExprString), "batch_if", {}, { OMNI_CHAR }, OMNI_CHAR, INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExpr<int64_t>), "batch_if", {}, { OMNI_DECIMAL64 }, OMNI_DECIMAL64,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExpr<int32_t>), "batch_if", {}, { OMNI_DATE32 }, OMNI_DATE32, INPUT_DATA),
        Function(reinterpret_cast<void *>(IfExpr<Decimal128>), "batch_if", {}, { OMNI_DECIMAL128 }, OMNI_DECIMAL128,
            INPUT_DATA),

        Function(reinterpret_cast<void *>(SwitchExpr<bool>), "batch_switch", {}, { OMNI_BOOLEAN }, OMNI_BOOLEAN,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExpr<int32_t>), "batch_switch", {}, { OMNI_INT }, OMNI_INT, INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExpr<int64_t>), "batch_switch", {}, { OMNI_LONG }, OMNI_LONG,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExpr<int64_t>), "batch_switch", {}, { OMNI_TIMESTAMP }, OMNI_TIMESTAMP,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExpr<double>), "batch_switch", {}, { OMNI_DOUBLE }, OMNI_DOUBLE,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExprString), "batch_switch", {}, { OMNI_CHAR }, OMNI_CHAR, INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExprString), "batch_switch", {}, { OMNI_VARCHAR }, OMNI_VARCHAR,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExpr<int64_t>), "batch_switch", {}, { OMNI_DECIMAL64 }, OMNI_DECIMAL64,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExpr<int32_t>), "batch_switch", {}, { OMNI_DATE32 }, OMNI_DATE32,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(SwitchExpr<Decimal128>), "batch_switch", {}, { OMNI_DECIMAL128 },
            OMNI_DECIMAL128, INPUT_DATA),

        Function(reinterpret_cast<void *>(InExpr<bool>), "batch_in", {}, { OMNI_BOOLEAN }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(InExpr<int32_t>), "batch_in", {}, { OMNI_INT }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(InExpr<int32_t>), "batch_in", {}, { OMNI_DATE32 }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(InExpr<int64_t>), "batch_in", {}, { OMNI_LONG }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(InExpr<int64_t>), "batch_in", {}, { OMNI_TIMESTAMP }, OMNI_BOOLEAN,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(InExpr<double>), "batch_in", {}, { OMNI_DOUBLE }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(InExprString), "batch_in", {}, { OMNI_CHAR }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(InExprString), "batch_in", {}, { OMNI_VARCHAR }, OMNI_BOOLEAN, INPUT_DATA),
        Function(reinterpret_cast<void *>(InExpr<int64_t>), "batch_in", {}, { OMNI_DECIMAL64 }, OMNI_BOOLEAN,
            INPUT_DATA),
        Function(reinterpret_cast<void *>(InExpr<Decimal128>), "batch_in", {}, { OMNI_DECIMAL128 }, OMNI_BOOLEAN,
            INPUT_DATA),
    };

    return utilFnRegistry;
}
}
